<?php
defined('IN_PHPCMS') or exit('No permission resources.');
pc_base::load_app_class('admin', 'admin', 0);
pc_base::load_sys_class('form', '', 0);

class redpacket extends admin{
	private $db;
	private $user_db;
	
	public function __construct(){
		parent::__construct();
		pc_base::load_app_class('global');
		$this->db = pc_base::load_model('red_packet_model');//加载红包推荐人model
		$this->user_db = pc_base::load_model('user_info_model');
	}
	
	/**
	 * 红包推荐人列表
	 */
	public function recommend(){
		$page = $_GET['page'] ? intval($_GET['page']) : 1;
		$where = "";
		if (isset($_GET['dosubmit'])) {
			if (!empty($_GET['tel'])) {
				$tel = $_GET['tel'];
				$where.= "user_tel = '$tel'";
			}
		}
		$red_packet = $this->db->listinfo($where,'id DESC',$page,10);
		$pages = $this->db->pages;
		$user_info = $this->user_db->select('','id,nickname');
		$user = array();
		foreach ($user_info as $k=>$v){
			$user[$v['id']] = $v['nickname'];
		}
		include $this->admin_tpl('red_packet_recmmoend');
	}
}